package ordenacion;

public class Main {
	public static void ordenar(Alumno[] alum, Comparador c) 
	{
		for (int i=0; i<alum.length; i++) 
		{
			for (int j=0; j<i; j++) 
			{
				if (c.comparar(alum[i],alum[j]) < 0) 
				{
					Alumno t = alum[i];
					alum[i] = alum[j];
					alum[j] = t;
				}
			}
		}
		
	}

	public static void imprimir(Alumno[] alum) 
	{
		for (int i=0; i<alum.length; i++) 
		{
			System.out.println(alum[i]);
		}
	}

	public static void main(String[] args)
	{
		Alumno[] alum = 
		{
			new Alumno ("A2", "Juan Perez", 19),
			new Alumno ("A1", "Maria Castro", 14),
			new Alumno ("B1", "Alberto Ruiz", 17)
		};
		ordenar(alum, new ComparadorNotasAsc());
		imprimir(alum);
		
	}
}
